package com.edu.exam.entity.classmanagement.teaching;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import jakarta.persistence.*;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import java.time.LocalDateTime;

/**
 * 教员分配实体类
 * [所属模块] F-06 教学班管理模块
 * 对应数据库表：teacher_assignment
 *
 * 根据简化后的F-06模块设计，管理教师与教学班的分配关系。
 * 支持主讲教师和辅讲教师角色的分配。
 * 提供教师排序和状态管理功能。
 *
 * @author System
 * @version 3.0.0 (简化版)
 */
@Entity
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = false)
@Table(name = "teacher_assignment")
public class TeacherAssignment {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id")
    private Long id;

    @NotNull(message = "教学班ID不能为空")
    @Column(name = "teaching_class_id", nullable = false)
    private Long teachingClassId;

    @NotNull(message = "教师ID不能为空")
    @Column(name = "teacher_id", nullable = false)
    private Long teacherId;

    @Column(name = "role", nullable = false, length = 20)
    @Builder.Default
    private String role = "ASSISTANT";

    @Column(name = "sort_order", nullable = false)
    @Builder.Default
    private Integer sortOrder = 0;

    @Column(name = "is_active", nullable = false)
    @Builder.Default
    private Boolean isActive = true;

    @Column(name = "assign_time", nullable = false)
    @Builder.Default
    private LocalDateTime assignTime = LocalDateTime.now();
}